home *** CD-ROM | disk | FTP | other *** search
/ Aminet 23 / Aminet 23 (1998)(GTI - Schatztruhe)[!][Feb 1998].iso / Aminet / dev / e / EasyPLUGINs.lha / EasyPLUGINs / examples / xygadget_demo.e < prev   
Text File  |  1997-11-08  |  2KB  |  60 lines

  1.  
  2. /*
  3.  
  4. */
  5.  
  6. OPT PREPROCESS, OSVERSION=37
  7.  
  8. MODULE 'tools/easygui', 'easyplugins/xygadget',
  9.        'utility', 'utility/tagitem'
  10.  
  11. DEF xygadget_1:PTR TO xygadget_plugin,
  12.     xygadget_2:PTR TO xygadget_plugin,
  13.     disabled=TRUE
  14.  
  15. PROC main() HANDLE
  16.  
  17.     IF (utilitybase:=OpenLibrary('utility.library', 37))=NIL THEN Raise("utlb")
  18.  
  19.     NEW xygadget_1.xygadget([PLA_XYGadget_Text, 'Testing',
  20.                              PLA_XYGadget_Disabled, disabled,
  21.                              TAG_DONE])
  22.  
  23.     NEW xygadget_2.xygadget([PLA_XYGadget_Text, 'A second gadget',
  24.                              PLA_XYGadget_Disabled, disabled,
  25.                              TAG_DONE])
  26.  
  27.     easyguiA('xygadget_plugin example', [ROWS,
  28.                                             [PLUGIN, {gadget_pressed}, xygadget_1, TRUE],
  29.                                             [PLUGIN, {gadget_pressed}, xygadget_2, TRUE],
  30.                                             [COLS,
  31.                                                 [CHECK, {toggle_disabled}, '_Disabled?', disabled, FALSE, -1, "d"],
  32.                                                 [SPACEH],
  33.                                                 [BUTTON, 0, 'Quit']
  34.                                             ]
  35.                                         ])
  36.  
  37. EXCEPT DO
  38.  
  39.     END xygadget_1, xygadget_2
  40.  
  41.     IF utilitybase THEN CloseLibrary(utilitybase)
  42.  
  43. ENDPROC
  44.  
  45. PROC toggle_disabled()
  46.  
  47.     IF disabled THEN disabled:=FALSE ELSE disabled:=TRUE
  48.  
  49.     xygadget_1.set(PLA_XYGadget_Disabled, disabled)
  50.     xygadget_2.set(PLA_XYGadget_Disabled, disabled)
  51.  
  52. ENDPROC
  53.  
  54. PROC gadget_pressed(gh:PTR TO guihandle, xygadget:PTR TO xygadget_plugin)
  55.  
  56.     WriteF('You pressed the gadget with \a\s\a on it.\n\n', xygadget.get(PLA_XYGadget_Text))
  57.  
  58. ENDPROC
  59.  
  60.